package auth

import (
	v1 "gitee.com/sweetsunnyflower/carpooling-server-go/app/http/controllers/api/v1"
	"gitee.com/sweetsunnyflower/carpooling-server-go/app/models/user"
	"gitee.com/sweetsunnyflower/carpooling-server-go/app/requests"
	"github.com/gofiber/fiber/v2"
)

type SignupController struct {
	v1.BaseController
}

func (controller *SignupController) IsPhoneExist(c *fiber.Ctx) error {

	request := new(requests.SignupPhoneExistRequest)

	if errors := requests.ValidateSignupPhoneExist(c, request); len(errors) > 0 {
		return controller.ValidationError(c, errors)
	}

	return c.JSON(map[string]bool{"exist": user.IsPhoneExist(request.Phone)})
}

func (controller *SignupController) IsEmailExist(c *fiber.Ctx) error {

	return c.SendString("Hello, World 👋!")

}
